package com.sl.service;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
public class Consumer{
	
	// 使用JmsListener配置消费者监听的队列，其中text是接收到的消息  
    @JmsListener(destination = "test.queue",containerFactory="jmsListenerContainerQueue")
    public void receiveQueue(String text) {
    	System.out.println("收到test.queue的消息为:"+text);
    }
    
    @JmsListener(destination = "test.topic",containerFactory="jmsListenerContainerTopic")
    public void receiveTopic(String text) {
    	System.out.println("收到test.topic的消息为:"+text);
    }
}
